<?php

namespace app\api\validate;
use think\Validate;

class User extends Validate{
    protected $rule = [
        'mobile'=>'require|regex:/1[34578]{1}\d{9}$/',
        'code'  =>'require', // 手机验证码
        'name'  =>'require', //社群名称| 用户名
        'person'=>'require',// 社群负责人真实姓名
        'scale' =>'require', // 社群规模
        'setup_time'    =>'require', // 社群成立时间
        'held_activity' =>'require', // 社群曾经举办过的活动类型
        'role'  => 'require',
    ];

    protected $message = [
        'mobile.require'        =>  1000,
        'mobile.regex'          =>  1001,
        'code.require'          =>  1002,
        'name.require'          =>  10000,
        'person.require'        =>  10001,
        'scale.require'         =>  10002,
        'setup_time.require'    =>  10003,
        'held_activity.require' =>  10004,
        'role.require'          =>  10005,
    ];

    protected $scene = [
        'sms' => ['mobile'],
        'validate' => ['mobile','code'],
        'community_register'   =>  ['role','mobile','name','person','scale','setup_time','held_activity'],// 社群注册
        /*'edit'  =>  ['username','showpwd'],// 编辑客户
        'login' =>  ['username','password'],
        'add_staff'   =>  ['username','password','type','task_list'],
        'edit_staff'  =>  ['username','showpwd','type','task_list'],*/
    ];
}